﻿using System;
using System.Xml.Serialization;  // Does XML serializing for a class.
using System.Drawing;            // Required for storing a Bitmap.
using System.IO;			     // Required for using Memory stream objects.


namespace RadarMonitor.Setting
{
    //// Mark class as serializable.
    //[Serializable]
    //public class RadarMonitorConfig
    //{
    //    public RadarMonitorConfig() { }

    //}


    [XmlRoot(DataType = "P20InfoHelper", IsNullable = false, Namespace = "http://sd.cma.gov.cn/gslb/whsqxj/")]
    public class RadarMonitorConfig
    {
        public RadarMonitorConfig()
        {
            if (!Directory.Exists(@"Config"))
            {
                Directory.CreateDirectory(@"Config");
            }
        }

        [XmlIgnore()]
        public static string FileName = @".\Config\config.xml";

        [XmlElement("DingDing")]
        public DingDingConfig DingDing = new DingDingConfig();

        [XmlElement("SMS")]
        public SMSConfig SMS = new SMSConfig();
        
        [XmlElement("BaseFTP")]
        public BaseFTPConfig baseFTP = new BaseFTPConfig();
        
        [XmlElement("ProductFTP")]
        public ProductFTPConfig productFTP = new ProductFTPConfig();
        
        [XmlElement("CIMISS")]
        public CIMISSConfig CIMISS = new CIMISSConfig();
        
          [XmlElement("Ping")]
        public PingConfig ping = new PingConfig();
        
           [XmlElement("RDA")]
        public StatusConfig status = new StatusConfig();
        

    }

    [Serializable]
    public class DingDingConfig
    {
        public DingDingConfig() { }

        [XmlAttribute]
        public string Webhook = "https://oapi.dingtalk.com/robot/send?access_token=36a21bf65e25d148a8f4d78126e8aaae0c279c5741f82cd942367061682975c3";
        public bool enable { get; set; }  = true;

    }

    [Serializable]
    public class SMSConfig
    {
        public SMSConfig() { }

        [XmlAttribute]
        public string SN = "239441";

        [XmlAttribute]
        public string UID = "wh_qxj";

        [XmlAttribute]
        public string PWD = "qxj123";

        [XmlAttribute]
        public bool enable { get; set; } = false;

    }

    [Serializable]
    public class BaseFTPConfig
    {
        public BaseFTPConfig() { }

        [XmlAttribute]
        public string url { get; set; } = "ftp://10.76.31.249/radar/archive/rawproducts/Z9631/CAR/";

        [XmlAttribute]
        public string UID = "Data_reader";

        [XmlAttribute]
        public string PWD = "Data_reader1";

        [XmlAttribute]
        public int CheckInterval { get; set; } = 10 * 60;

        [XmlAttribute]
        public int AlarmRange { get; set; } = 18 * 60;

        [XmlAttribute]
        public bool AutoStart { get; set; } = true;

         [XmlAttribute]
        public bool DingDingEnabel { get; set; } = true;

         [XmlAttribute]
        public bool SmsEnabel { get; set; } = false;

        
         [XmlAttribute]
        public bool AudioEnabel { get; set; } = true;


    }
  
    [Serializable]
    public class ProductFTPConfig
    {
        public ProductFTPConfig() { }

        [XmlAttribute]
        public string url { get; set; } = "ftp://10.76.31.249/radar/archive/fmt/Z9631/";

        [XmlAttribute]
        public string UID = "Data_reader";

        [XmlAttribute]
        public string PWD = "Data_reader1";

        [XmlAttribute]
        public int CheckInterval { get; set; } = 6 * 60;

        [XmlAttribute]
        public int AlarmRange { get; set; } = 8 * 60;


        [XmlAttribute]
        public bool AutoStart { get; set; } = true;

        [XmlAttribute]
        public bool DingDingEnabel { get; set; } = true;

        [XmlAttribute]
        public bool SmsEnabel { get; set; } = false;


        [XmlAttribute]
        public bool AudioEnabel { get; set; } = true;


    }

    [Serializable]
    public class CIMISSConfig
    {
        public CIMISSConfig() { }

        [XmlAttribute]
        public string UID = "Data_reader";

        [XmlAttribute]
        public string PWD = "Data_reader1"; 
        
        [XmlAttribute]
        public string StateID = "Z9631";

        [XmlAttribute]
        public int  CheckInterval { get; set; } = 6*60;

        [XmlAttribute]
        public int  AlarmRange { get; set; } = 16 * 60;


        [XmlAttribute]
        public bool AutoStart { get; set; } = true;

        [XmlAttribute]
        public bool DingDingEnabel { get; set; } = true;

        [XmlAttribute]
        public bool SmsEnabel { get; set; } = false;


        [XmlAttribute]
        public bool AudioEnabel { get; set; } = true;


    }


    [Serializable]
    public class PingConfig
    {
        public PingConfig() { }


        [XmlAttribute]
        public string IP = "10.78.135.200";

        [XmlAttribute]
        public int PingInterval = 60;

        [XmlAttribute]
        public bool AutoStart { get; set; } = true;

        [XmlAttribute]
        public bool DingDingEnabel { get; set; } = true;

        [XmlAttribute]
        public bool SmsEnabel { get; set; } = false;


        [XmlAttribute]
        public bool AudioEnabel { get; set; }  = true;

    }


     [Serializable]
    public class StatusConfig
    {
        public StatusConfig() { }


        [XmlAttribute]
        public string rdaIP = "10.78.135.220";

        [XmlAttribute]
        public bool AutoStart { get; set; } = true;

        [XmlAttribute]
        public bool DingDingEnabel { get; set; } = true;

        [XmlAttribute]
        public bool SmsEnabel { get; set; } = false;


        [XmlAttribute]
        public bool AudioEnabel { get; set; } = true;

    }


    

}
